﻿@{
    Layout = null;

   

}
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>实名信息</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" href="~/Content/css/base.css" />
    <link rel="stylesheet" href="~/Content/css/tuoken.css" />
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/js/base.js"></script>
    <script src="~/Content/js/layer/1.9.3/layer.js"></script>
</head>

<body>
    <div class="aboutwhite">
        <div class="autoinfoct">
            <div class="info">
                <h2 class="nickname">设置昵称</h2>
            </div>

            <input class="name" type="text" id="code" placeholder="请输入拓垦邀请码">
            <input class="name" type="text" id="nickname" placeholder="请设置昵称">
            <input type="button" class="autobtn" id="autobtn" onclick="submite()" value="下一步">

        </div>
        <script type="text/javascript">
            $("input").keyup(function () {
                var code = $("#code").val();
                var nickname = $("#nickname").val();
                if (code != "" && nickname != "") {
                    $("#autobtn").attr("disabled", false);
                    $('#autobtn').addClass('on');
                } else {
                    $("#autobtn").attr("disabled", true);
                    $('#autobtn').removeClass('on');
                }
            })
        </script>
        <script type="text/javascript">
            $("input").keyup(function () {
                var name = $("#name").val();
                var ident = $("#ident").val();
                if (name != "" && ident != "") {
                    $("#autobtn").attr("disabled", false);
                    $('#autobtn').addClass('on');
                } else {
                    $("#autobtn").attr("disabled", true);
                    $('#autobtn').removeClass('on');
                }
            })
            var flag = false; 
            function submite() {
            
                    if ($("#name").val() == "" || $("#ident").val() == "") {
                        layer.msg("请填写信息");
                    } else {
                        if (flag) return;
                        flag = true;
                        $.ajax({
                            //几个参数需要注意一下
                            type: "POST",//方法类型
                            dataType: "json",//预期服务器返回的数据类型
                            url: "/User/SetNamePost",//url
                            data: { Code: $("#code").val(), NickName: $("#nickname").val() },
                            success: function (result) {
                                if (result.result_code== 1000) {
                                    layer.msg(result.result_msg);
                                    window.location.href = "/User/Authentication";
                                }
                                else {
                                    layer.msg(result.result_msg);
                                }
                                flag = false; 
                            },
                            error: function () {
                                layer.msg("异常！");
                                flag = false; 
                            }
                        });
                    
                }
            }
        </script>
</body>



</html>